#
# Copyright © 2021 深圳百问网科技有限公司 All Rights Reserved.
# https://www.100ask.net
# https://shop502068889.taobao.com/
#
# SPDX-License-Identifier: BSD-3-Clause
#

"""
接线
    Vcc     --- 5v
    GND     --- GND
    Trigger --- 13
    Echo    --- 12
"""

from machine import Pin
from hcsr04 import HCSR04


sensor = HCSR04(trigger_pin=13, echo_pin=12,echo_timeout_us=1000000)

try:
  while True:
    distance = sensor.distance_cm()
    print(distance)
except KeyboardInterrupt:
       pass
